import type { AddressItem, OrderDetail, OrderPre, Logistics } from "@/types/order"
import request from "@/utils/request"

//订单预支付
export const getMedicalOrderPre = (params: { prescriptionId: string }) => 
    request<OrderPre>({url:'/patient/medicine/order/pre', method:'GET', params})
//收货地址
export const getAddresList = () => request<AddressItem[]>('/patient/order/address')

//创建药品订单   ({url:'/patient/medicine/order', method:'POST', data})
export const createMedicalOrder = (data: {
    id: string
    addressId: string
    couponId?: string
}) => request<{id: string}>({url:'/patient/medicine/order', method:'POST', data})

//获取订单详情
export const getMedicalOrderDetail = (id: string) => request<OrderDetail>(`/patient/medicine/order/detail/${id}`)

//物流详情api
export const getMedicalOrderLogistics = (id: string) => request<Logistics>(`/patient/order/${id}/logistics`)